import { Component, OnInit, Input } from '@angular/core';
import { TableInfo } from '../../models/user';
import { AuthService } from '../../services/auth.service';

@Component({
  selector: 'app-lucky-table',
  templateUrl: './lucky-table.component.html',
  styleUrls: ['./lucky-table.component.less']
})
export class LuckyTableComponent implements OnInit {
  @Input() tableInfoList: TableInfo[];
  addTable = false;
  constructor(private authService: AuthService) {}
  ngOnInit(): void {}
  deleteTable({ id, title }: TableInfo, index: number) {
    const r = confirm(`确定要删除表:<${title}>吗`);
    if (r === true) {
      this.authService.delTable(id, index);
    }
  }
  closeAddTable() {
    this.addTable = false;
  }
}
